<template>
  <div class="page">
    <div class="list_box" style="top:0" ref="box">
      <van-list v-model="loading" :finished="finished" @load="getList">
        <div v-for="(item,index) in list" :key="index" :to="'/list0_2?id='+item.id+'&t='+item.title" class="list_item" @click="to('/list0_2?id='+item.id+'&t='+item.title)">
            <div class="titBox">
              <div class="tit">{{item.title}}</div>
            </div>
            <p>{{item.publish_date}}</p>
            <!-- <p>{{item.publish_date}}<span class="time_1">{{item.learn_duration}}</span></p> -->
        </div>
        <div class="finished" v-if="finished">加载完毕</div>
      </van-list>
    </div>
  </div>
</template>

<script>
import { Dialog } from "vant";
export default {
  data() {
    return {
      title:"",
      list: [],
      loading: false,
      finished: false,
      scrollTop:0
    };
  },
  mounted: function() {
    this.getList()
    maxusJSB.tojson({title:this.$route.query.t,left:"关闭"})
  },
  methods: {
    // 请求列表
    getList() {
      this.$http
        .get("?key=&request=front&operation=course-attf&client=1&by=admin&id="+this.$route.query.id+"&user_id="+this.getUserID+"&_="+Date.parse(new Date()))
        .then(response => {
          if(response.ret==1){
            this.list=response.data
            this.loading=false
            this.finished=true
            this.$refs.box.scrollTop=this.getCookie('scrollTop')
          }
        });
    },
    to(url){
      this.scrollTop=this.$refs.box.scrollTop;
      this.setCookie('scrollTop',this.scrollTop)
      this.$router.push(url)
    }
  }
};
</script>